function t(t, e, a) {
    return e in t ? Object.defineProperty(t, e, {
        value: a,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[e] = a, t;
}

var e, a = getApp(), i = require("../../utils/icon.js"), n = require("../../utils/point.js"), s = require("../../utils/scrollx.js");

Page({
    data: (e = {
        imgUrls: [ "http://fang-oss.haozu.com/cms/index/2018/04/17/sRS6YK6pM7.jpg@750w_490h_1e_1c" ],
        pointInfo: {},
        building: {},
        simpleInfo: {},
        gxlist: [],
        zblist: [],
        mapUrl: [],
        tel_phone: "",
        companyList: [],
        baseList: [],
        total: 0,
        currIndex: 1,
        share: 0,
        isUp: !0,
        showYK: !1,
        shade: !1,
        subsucc: !1,
        hasError: !1,
        resPhone: "",
        isYK: !1,
        isDis: !1,
        isSC: !1,
        seeWidth: 0,
        ulen: 300,
        moveCurr: 0,
        shareimg: i.fenxiang,
        xingimg: i.xing,
        mapimg: i.mapimg,
        zhankai: i.zhankai,
        rightmore: i.rightmore,
        heart: i.heart,
        heart_red: i.heart_red,
        error_icon: i.error,
        close: i.close,
        consultant: []
    }, t(e, "consultant", ""), t(e, "consultantA", ""), t(e, "consultantA", []), e),
    changeCur: function(t) {
        this.setData({
            currIndex: t.detail.current + 1
        });
    },
    showAll: function() {
        this.setData({
            isUp: !1
        });
    },
    toMapInfo: function() {
        var t = this.data.building;
        wx.navigateTo({
            url: "/pages/map/map?name=" + t.name + "&address=" + t.address + "&lat=" + t.lat + "&lng=" + t.lng
        });
    },
    onLoad: function(t) {
        t.point_id = t.point_id || "35";
        var e = this;
        if (t.scene) {
            var i = decodeURIComponent(t.scene).split("&"), s = {
                type: i[0],
                id: i[1],
                phone: i[2]
            };
            t.point_id = s.id;
        }
        e.setData({
            share: t.share ? t.share : 0,
            tel_phone: a.globalData["tel-phone"]
        });
        var o = a.getSecret(), r = a.globalData.userInfo || {};
        r && r.mobile && e.setData({
            isDis: !0,
            resPhone: r.mobile,
            loginYK: !1,
            isYK: !0
        }), wx.request({
            url: a.globalData.haozuBase + "/api/miniapps/point/",
            data: {
                point_id: t.point_id,
                mobile: r.mobile || "",
                user_guid: r.user_guid || "",
                currtime: o.currtime,
                sign: o.sign,
                uuid: wx.getStorageSync("first_code")
            },
            success: function(t) {
                var i = t.data;
                if (200 === i.code) {
                    var s = i.data.topic_image_list, o = i.data.point_info, r = i.data.simple_info, u = i.data.building_info, l = [];
                    for (var c in o.baseService) l.push({
                        key: c,
                        name: o.baseService[c]
                    });
                    var d = [];
                    for (var c in o.companyService) d.push({
                        key: c,
                        name: o.companyService[c]
                    });
                    i.data.employee_list, i.data.employee_list[0];
                    e.setData({
                        building: i.data.building_info,
                        pointInfo: o,
                        simpleInfo: r,
                        imgUrls: s,
                        gxlist: i.data.house_list,
                        zblist: i.data.recommend_point_list,
                        total: s ? s.length : 0,
                        companyList: d,
                        baseList: l,
                        consultant: i.data.employee_list,
                        consultantA: i.data.employee_list[0]
                    });
                    var p = i.data.building_info.lat, g = i.data.building_info.lng;
                    n.getPoint({
                        lat: p,
                        lng: g
                    }).then(function(t) {
                        e.setData({
                            mapUrl: "http://apis.map.qq.com/ws/staticmap/v2/?center=" + t.lat + "," + t.lng + "&zoom=15&size=750*400&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:H|" + t.lat + "," + t.lng + "&key=" + a.globalData.tencentMapKey
                        });
                    }), a.orderDisabled(e, e.data.building.id, "building_id");
                    var m = {
                        id: "",
                        status: "",
                        circle_name: "",
                        district_name: "",
                        thumb_image: ""
                    };
                    for (var h in m) m[h] = o[h] || r[h] || s[h];
                    m.building_name = o.name, m.gongwei_number_min = r.stationSection.min, m.gongwei_number_max = r.stationSection.max, 
                    m.rent_price = r.minPrice.showPrice, m.price_unit = r.minPrice.priceUnit, m.district_name = u.district_name, 
                    m.street_name = u.street_name, m.circle_name = u.circle_name, m.subway_display = u.subway[0], 
                    m.thumb_image = s[0], m.type = 1;
                    var _ = {
                        t: 1,
                        v: o.id,
                        c: u.city_id,
                        d: u.district_id,
                        ci: u.circle_id,
                        s: u.street_id,
                        vt: new Date().getTime(),
                        ca: 3
                    };
                    a.saveStorage(_, m);
                }
                "1" == t.data.data.isCollect && e.setData({
                    isSC: !0
                });
            }
        });
    },
    onShareAppMessage: function(t) {
        var e = this;
        return {
            title: e.data.pointInfo.name,
            desc: e.data.building.address,
            path: "/pages/netpoint/netpoint?share=1&point_id=" + e.data.pointInfo.id
        };
    },
    onReady: function(t) {
        var e = this, a = wx.createSelectorQuery();
        a.select(".head_swiper").boundingClientRect(), a.exec(function(t) {
            var a = t[0].width;
            e.setData({
                seeWidth: a - 30 * a / 750
            });
        });
    },
    touchStart: s.touchStart,
    touchEnd: function(t) {
        s.touchEnd.call(this, t), s.goFun.call(this, t);
    },
    turnScroll: s.turnScroll,
    turnEnd: function(t) {
        s.goFun.call(this, t);
    },
    showyekan: function(t) {
        this.setData({
            shade: !0,
            showYK: !0
        });
    },
    closeyuekan: function(t) {
        this.setData({
            shade: !1,
            showYK: !1
        });
    },
    inputChange: function(t) {
        this.setData({
            resPhone: t.detail.value
        });
    },
    submitYK: function(t) {
        var e = this, i = /^(13[0-9]|14[5|7]|15[0-9]|17[0|1|3|5|6|7|8]|18[0-9])\d{8}$/, n = e.data.resPhone;
        return !e.data.isYK && (i.test(n) ? (e.setData({
            hasError: !1
        }), void a.orderlogin({
            mobile: n,
            name: "小程序网点页预约",
            login: a.globalData.userInfo ? 0 : 1,
            building_id: e.data.building.id,
            building_name: e.data.building.name,
            from_page: 2
        }).then(function(t) {
            200 == t.code && (e.setData({
                showYK: !1,
                subsucc: !0,
                isYK: !0
            }), setTimeout(function() {
                e.setData({
                    shade: !1,
                    subsucc: !1
                });
            }, 3e3));
        })) : (e.setData({
            hasError: !0
        }), !1));
    },
    shouchang: function(t) {
        var e = this, i = a.globalData.userInfo || {};
        if (a.globalData.userInfo) {
            var n = a.getSecret(), i = a.globalData.userInfo || {};
            e.data.isSC ? wx.request({
                url: a.globalData.uchaozuBase + "/api/miniapps/collect/del/",
                data: {
                    uid: i.user_id || "",
                    type: "1",
                    opt_id: e.data.pointInfo.id,
                    currtime: n.currtime,
                    sign: n.sign,
                    collect_type: 3
                },
                success: function(t) {
                    t.data;
                    if (500 === t.statusCode) return !1;
                    e.setData({
                        isSC: !1
                    });
                }
            }) : wx.request({
                url: a.globalData.uchaozuBase + "/api/miniapps/collect/add/",
                data: {
                    uid: i.user_id || "",
                    type: "1",
                    opt_id: e.data.pointInfo.id,
                    currtime: n.currtime,
                    sign: n.sign,
                    collect_type: 3
                },
                success: function(t) {
                    t.data;
                    if (500 === t.statusCode) return !1;
                    e.setData({
                        isSC: !0
                    });
                }
            });
        } else wx.setStorage({
            key: "HdataInfo",
            data: {
                uid: i.user_id || "",
                type: "1",
                opt_id: e.data.pointInfo.id,
                collect_type: 3
            }
        }), wx.navigateTo({
            url: "/pages/getinfo/index"
        });
    },
    zixun: function(t) {
        wx.makePhoneCall({
            phoneNumber: t.currentTarget.dataset.phone
        });
    },
    zixunA: function() {
        wx.makePhoneCall({
            phoneNumber: this.data.consultantA.telephone
        });
    },
    xixika: function(t) {
        var e = [];
        e.push(t.currentTarget.dataset.id), wx.previewImage({
            current: t.currentTarget.dataset.id,
            urls: e
        });
    },
    zhizhao: function(t) {
        var e = [];
        e.push(t.currentTarget.dataset.id), wx.previewImage({
            current: t.currentTarget.dataset.id,
            urls: e
        });
    },
    showMore: function() {
        this.setData({
            isUp: !1
        });
    }
});